<?php
declare (strict_types = 1);

namespace app\api\controller;

use think\facade\Db;

use app\common\model\Lists as ListsModel;

/**
 * @title 后台设置内容
 * @description 接口说明
 * //@group 接口分组
 * //@header name:key require:1 default: desc:秘钥(区别设置)
 * //@param name:public type:int require:1 default:1 other: desc:公共参数(区别设置)
 */
class Webconfig extends Base
{
    /**
     * @title 获取后台设置
     * @description 获取后台设置
     * @author 开发者 唐寅
     * @url /api/Webconfig/getWebconfig
     * @method GET POST
     *
     * @param name:site_id type:int require:1 default:0 other: desc:站点id
     * @param name:key type:varchar require:1 default: other: desc:数组key值
     */
    public function getWebconfig(){
        $param = input("param.");
        $site_id = isset($param['site_id'])?$param['site_id']:1;

        $webconfig = DB::name("webconfig")
            ->where("siteid","=",$site_id)
            ->where("vargroup","=",0)
            ->select();
        $webconfig_arr = [];
        foreach($webconfig as $v){
            $webconfig_arr[$v['varname']] = $v['varvalue'];
        }
        if(isset($param['key'])){
            if($webconfig_arr[$param['key']]){
                return dyajaxReturn(1,'获取成功',$webconfig_arr[$param['key']]);
            }
        }

        return dyajaxReturn(1,'获取成功',$webconfig_arr);
    }















}
